﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="备件品种录入.aspx.cs" Inherits="syc.Jidong.备件品种录入" %>
<html>
<head>
<title></title>
</head>
<style>
div.autofinish{position:absolute; z-index:2;border:solid 1px #ccaa88;background-color:#ffffff;padding:5px;font-size:14px;color:#ff0000;}
#BianHao{background-image:url(/images/bmback.gif); background-repeat:no-repeat;}
</style>
<body>
<script type="text/javascript" language="javascript" src="/common.js"></script>
<form id="form1" runat="server">

<asp:SqlDataSource ID="SqlDataSource1" runat="server" 
ConnectionString="<%$ ConnectionStrings:SCMConnectionString1 %>"
onselected="SqlDataSource1_Selected" >
</asp:SqlDataSource>

<asp:SqlDataSource ID="SqlDataSource2" runat="server" 
ConnectionString="<%$ ConnectionStrings:SCMConnectionString1 %>"
SelectCommand="select @品名=品名,@规格=规格,@单位=单位,@单价=cast(单价 as float),@编码=编码,@简码=简码,@权重=权重 from 备品备件 where ID=@ID"
InsertCommand="insert into 备品备件(品名,规格,单位,单价,编码,简码,权重)values(@品名,@规格,@单位,@单价,@编码,@简码,@权重);set @ID=@@IDENTITY;"
UpdateCommand="update 备品备件 set 品名=@品名,规格=@规格,单位=@单位,单价=@单价,编码=@编码,简码=@简码,权重=@权重 where ID=@ID" 
oninserted="SqlDataSource2_Inserted" onselected="SqlDataSource2_Selected"
>
<SelectParameters>
<asp:Parameter Name="ID" DbType="Int32"  Size="4"/>
<asp:Parameter Name="品名" DbType="String"  Size="40" Direction="Output"/>
<asp:Parameter Name="规格" DbType="AnsiString" Size="40" Direction="Output"/>
<asp:Parameter Name="单位" DbType="AnsiString"  Size="10" Direction="Output"/>
<asp:Parameter Name="单价" DbType="Double" Size="9" Direction="Output"/>
<asp:Parameter Name="编码" DbType="AnsiString"  Size="10" Direction="Output"/>
<asp:Parameter Name="简码" DbType="AnsiString"  Size="20" Direction="Output"/>
<asp:Parameter Name="权重" DbType="Int32"  Size="4" Direction="Output"/>
</SelectParameters>
<InsertParameters>
<asp:Parameter Name="ID" DbType="Int32" Size="4" Direction="Output"/>
<asp:ControlParameter Name="品名" DbType="String"  Size="40" ControlID="PinMing"/>
<asp:ControlParameter Name="规格" DbType="AnsiString" Size="40" ControlID="GuiGe"/>
<asp:ControlParameter Name="单位" DbType="AnsiString"  Size="10" ControlID="DanWei"/>
<asp:ControlParameter Name="单价" DbType="Decimal"  Size="9" ControlID="DanJia"/>
<asp:ControlParameter Name="编码" DbType="AnsiString"  Size="10" ControlID="BianMa"/>
<asp:ControlParameter Name="简码" DbType="AnsiString"  Size="20" ControlID="JianMa"/>
<asp:ControlParameter Name="权重" DbType="Int32"  Size="4" ControlID="QuanZhong"/>
</InsertParameters>
<UpdateParameters>
<asp:ControlParameter Name="ID" DbType="Int32" Size="4" ControlID="BillID"/>
<asp:ControlParameter Name="品名" DbType="String"  Size="40" ControlID="PinMing"/>
<asp:ControlParameter Name="规格" DbType="AnsiString" Size="40" ControlID="GuiGe"/>
<asp:ControlParameter Name="单位" DbType="AnsiString"  Size="10" ControlID="DanWei"/>
<asp:ControlParameter Name="单价" DbType="Decimal"  Size="9" ControlID="DanJia"/>
<asp:ControlParameter Name="编码" DbType="AnsiString"  Size="10" ControlID="BianMa"/>
<asp:ControlParameter Name="简码" DbType="AnsiString"  Size="20" ControlID="JianMa"/>
<asp:ControlParameter Name="权重" DbType="Int32"  Size="4" ControlID="QuanZhong"/>
</UpdateParameters>
</asp:SqlDataSource>
<asp:Label ID="BillID" runat="server" Text="" Visible="false"></asp:Label>

<div id="wintop" class="wintop" style="display:none;">备品备件品种录入</div>
<asp:Panel ID="Panel1" runat="server" CssClass="panel">
    <asp:Button ID="Button_Save" runat="server" Text="保 存" UseSubmitBehavior="false" 
        CssClass="button" onclick="Button_Save_Click" />
    <input type="button" value="关 闭" class="button" onclick="parent.swin2_close();" />
</asp:Panel>

<asp:Panel ID="Panel2" runat="server" CssClass="panel">
<table border="1" style="border-collapse:separate;font-size:14px;">
<tr height=26>
<td width=80 align=right>品 名：</td>
<td Width="140"><asp:TextBox ID="PinMing" runat="server" CssClass="textbox" 
        Width="120" AutoPostBack="True" ontextchanged="PinMing_TextChanged" ></asp:TextBox><font color=red >*</font></td>
<td width=80 align=right>规 格：</td>
<td Width="260"><asp:TextBox ID="GuiGe" runat="server" CssClass="textbox" Width="120" ></asp:TextBox></td>
</tr>
<tr height=26>
<td align=right>单 位：</td>
<td><asp:TextBox ID="DanWei" runat="server" CssClass="textbox" Width="120" ></asp:TextBox></td>
<td align=right>单价(元)：</td>
<td><asp:TextBox ID="DanJia" runat="server" CssClass="textbox" Width="120" ></asp:TextBox></td>
</tr>
<tr height=26>
<td align=right>编 码：</td>
<td><asp:TextBox ID="BianMa" runat="server" CssClass="textbox" Width="120" ></asp:TextBox></td>
<td align=right>简 码：</td>
<td nowrap><asp:TextBox ID="JianMa" runat="server" CssClass="textbox" Width="120" ></asp:TextBox>
<span style=font-size:13px;>方便录入的简单代码</span>
</td>
</tr>
<tr height=26>
<td align=right>权 重：</td>
<td colspan=3 nowrap><asp:TextBox ID="QuanZhong" runat="server" CssClass="textbox" Width="120" ></asp:TextBox>
<span style=font-size:13px;>填写一个 0 ～ 10000 的数字，数值越大越表示物品越重要。</span>

</td>
</tr>
</table>
</asp:Panel>

<div class="gridframe" style="padding:4px;">
    <div class="gridview">
    
        <table border="1" width="100%" cellspacing="0" cellpadding="0" bordercolor="#e5cfab">
            <tr>
	            <td class="grid-title">类似品种</td>
	        </tr>
	        <tr>
	            <td class="grid-back" style="height:155px;">
                    <asp:GridView ID="GridView1" runat="server" AllowPaging="True" 
                        AutoGenerateColumns="False" CssClass="grid"
                        DataSourceID="SqlDataSource1"
                        PageSize="5"
                        GridLines="None" ondatabound="GridView1_DataBound" 
                        onpageindexchanged="GridView1_PageIndexChanged" AllowSorting="False" 
                        UseAccessibleHeader="False">
                        <PagerSettings Visible="False" />
                        <RowStyle CssClass="grid-row-normal" />
                        <Columns>
                            <asp:TemplateField HeaderText="">
                                <ItemTemplate>
                                    <img src="/Icons/online.gif" style="margin-top:2px;" alt="" />
                                </ItemTemplate>
                                <HeaderStyle CssClass="grid-header" />
                                <ItemStyle CssClass="grid" HorizontalAlign="Center" Width="30px" />
                            </asp:TemplateField>              
                            <asp:TemplateField HeaderText="品名">
                                <ItemTemplate>
                                    <asp:Label ID="Label_pm" runat="server" Text='<%# Eval("品名") %>'></asp:Label>
                                </ItemTemplate>
                                <HeaderStyle CssClass="grid-header" />
                                <ItemStyle CssClass="grid" HorizontalAlign="center" Width="140px" />
                            </asp:TemplateField>

                            <asp:TemplateField HeaderText="规格">
                                <ItemTemplate>
                                    <asp:Label ID="Label_gg" runat="server" Text='<%# Eval("规格") %>'></asp:Label>
                                </ItemTemplate>
                                <HeaderStyle CssClass="grid-header" />
                                <ItemStyle CssClass="grid" HorizontalAlign="center" Width="140px" />
                            </asp:TemplateField>
                            
                            
                            <asp:TemplateField HeaderText="单位">
                                <ItemTemplate>
                                    <asp:Label ID="Label_dw" runat="server" Text='<%# Eval("单位") %>'></asp:Label>
                                </ItemTemplate>
                                <HeaderStyle CssClass="grid-header" />
                                <ItemStyle CssClass="grid" HorizontalAlign="center" Width="60px" />
                            </asp:TemplateField>
                            
                            <asp:TemplateField HeaderText="单价元)">
                                <ItemTemplate>
                                    <asp:Label ID="Label_dj" runat="server" Text='<%# Eval("单价") %>'></asp:Label>
                                </ItemTemplate>
                                <HeaderStyle CssClass="grid-header" />
                                <ItemStyle CssClass="grid" HorizontalAlign="right" Width="70px" />
                            </asp:TemplateField>

                        </Columns>
                        <SelectedRowStyle CssClass="grid-row-selected" />
                      </asp:GridView>
	            </td>
            </tr>
            <tr>
	            <td>   
	                <table width="100%">
	                    <tr>
	                        <td class="pagebar">
                                <asp:Button ID="Button_Pager_First" UseSubmitBehavior="false" runat="server" Text="" ToolTip="首页" 
                                    CssClass="pageturn-first-b" onclick="Pager_Click" CommandName="--" />
                                <asp:Button ID="Button_Pager_Prev" UseSubmitBehavior="false" runat="server" Text="" ToolTip="上一页" 
                                    CssClass="pageturn-prev-b" onclick="Pager_Click" CommandName="-" />
                                <input type="button" class="page-split" UseSubmitBehavior="false" disabled />第<asp:TextBox 
                                    ID="TextBox_Pager" AutoPostBack="True" runat="server" CssClass="pageturn" 
                                    ontextchanged="Pager_Click"></asp:TextBox>页<input type="button" class="page-split" disabled /><asp:Label ID="Label_Pages" UseSubmitBehavior="false" runat="server"></asp:Label><input type="button" class="page-split" disabled />
                                
                                <asp:Button ID="Button_Pager_Next" UseSubmitBehavior="false" runat="server" Text="" ToolTip="下一页" 
                                    CssClass="pageturn-next-b" onclick="Pager_Click" CommandName="+" />
                                <asp:Button ID="Button_Pager_Last" UseSubmitBehavior="false" runat="server" Text="" ToolTip="末页" 
                                    CssClass="pageturn-last-b" onclick="Pager_Click" CommandName="++" /><asp:Label ID="Label9" runat="server"></asp:Label><input type="button" class="page-split" disabled />
                            </td>
                            <td class="pagebar" align="right">
                                <asp:Label ID="Label_Total" runat="server"></asp:Label>
                            </td>
                        </tr>
                   </table>

	            </td>
            </tr>
        </table>
        

    </div>
</div>





</form>

<script>
    var notice = '<%=this.Notice %>';
    if (notice != '') {
        parent.showmsgbox(notice);
    }
    var textboxs = document.getElementsByTagName("input");
    var i;
    for (i = 0; i < textboxs.length; i++) {
        if (textboxs[i].className == "textbox") {
            //textboxs[i].onchange = function(e) { this.className = "textbox-changed"; };
            textboxs[i].onfocus = function(e) { this.select(); };
        }
        else if (textboxs[i].className == "pageturn" || textboxs[i].className == "intxt1" || textboxs[i].className == "intxt2") {
            textboxs[i].onfocus = function(e) { this.select(); };
        }
    }
    document.onkeydown = function(e) {
        if (!e) e = window.event;
        var tag = e.srcElement;
        if (!tag) tag = e.target;
        if (tag.tagName != "INPUT" || tag.className != "textbox") return;
        if (tag.id == "BeiZhu") return;
        if (e.keyCode == 13) e.keyCode = 9;
    }

</script>
</body>
</html>
